
<!-- 会被 web（站外页）用到，故提出来. scss亦是  -->

<script id="tpl-post" type="text/x-dot-template">
    <section class="post-title-part aui-content aui-content-padded">
		{{? str_being(it.sharethumbnail)}}
			<!-- 见collectShareData中注释 -->
			<img class="share-thumb aui-hide" src="../../../global/image/logo.png" data-src="{{=absAssetUrl(it.sharethumbnail)}}" org-src="{{=absAssetUrl(it.sharethumbnail)}}"/>
		{{??}}
			<img class="share-thumb aui-hide" src="../../../global/image/logo.png" data-src="{{=httpGIdLogoUrl()}}" org-src="{{=httpGIdLogoUrl()}}"/>
		{{?}}
		<h3 class="post-subject">{{=decodeEmoji(it.subject)}}</h3>
	</section>

    {{? arr_being(it.semantic)}}
    <div id="tags-frame">
        <div class="tags-container">
            {{~it.semantic :v:i}}
                <div><label tapmode onclick="openForum(this);" data-name="{{=v}}" data-fid="{{=it.fid}}">{{=v}}</label></div>
            {{~}}
        </div>
    </div>
    {{?}}

    <section class="aui-content">
        <div class="auix-user-bar aui-card-list-header aui-card-list-user">
			<div tapmode onclick="views.openUCenterWin({{=it.authorid}}, &quot;{{=escapeStr(decodeEmoji(it.author))}}&quot;);">
	            <div class="avatar aui-card-list-user-avatar">
                    <img src="{{=it.avatar}}" data-type="avatar" class="aui-img-round" />
	            </div>
                <div class="aui-card-list-user-name">
                    <div>
    	                <span class="nick">{{=shortNick(decodeEmoji(it.author))}}</span>
                        {{? it.gender != 0}}
                            <img class="auix-gender" src="../../../global/image/gender{{=it.gender}}.png" >
                        {{?}}
                        <span class="labels">{{=app.userLV.getHtml(it.levelscore,it.ismaster,it.ismoderator, it.ispartner, it.ismember)}}</span>
                    </div>
	            </div>
			</div>
            <div class="post-date">
                {{? str_being(it.residecommunity)}}
    				<span class="reside">{{=it.residecommunity}}</span>
                {{?}}
                <span>{{=vdateF(it.dateline)}}</span>

                <span class="s-11 bg-blue c-f r30 p-l3 p-r3 aui-hide" id="original-author">原作者</span>

			</div>
			<div id="touch-ta" class="touch-ta aui-hide">
				<div class="aui-btn aui-btn-info aui-btn-outlined" data-uid="{{=it.authorid}}" data-nick="{{=decodeEmoji(it.author)}}" tapmode onclick="views.chatWithTa(this);">私信</div>
			</div>
        </div>
    </section>
    <section class="post-main-part aui-content aui-content-padded">
        <div class="post-content auix-text-selectable" >{{=myEmo.transText(fmtContent(it.content, @@lazy, getImgsCollector(it), true))}}</div>
	</section>

</script>

<script>

function getImgsCollector(json) {
    return (json.notCollectImgs ? undefined : window.imgsCollector);
}

// 此方法也会被web（站外页）用到
function collectShareData() {
    var post = $api.byId('post');
	var cont = $api.dom(post, '.post-content').innerText;
	var thumb = $api.dom(post, '.share-thumb');

	// 此代码为app和web共用。分享时，wx要求：app中须为本地路径（fs、wedgit等）且大小不能超过32K（否则iOS会分享失败），web中自然需要是http路径。故，app中用src，web中用org-src
	// 若无缩略图，则用logo.png，但org-src还是用server上的，否则qq中分享时有问题。
	// 最终，可以认为有图和无图的处理逻辑是一样的。
	var thumbUrl = $api.attr(thumb, 'src');
	var thumbUrlOrg = $api.attr(thumb, 'org-src');
	var title = $api.dom(post, '.post-subject').innerText;
	var desc = filterTags(cont).fix_substring(0, 100);

	return {
		title: title,
		desc: str_being(desc) ? desc : title,
		thumb: thumbUrl,
		thumbWeb: thumbUrlOrg,
	}
}

// app中分享一定要本地图片，故必须要将web图片保存到本地。如果用户手太快（还未等下载到本地就分享），在会应用logo
// 点击“分享”按钮时，调用此方法，获取当前本地图片
function getCurShareThumb() {
    var post = $api.byId('post');
	var thumb = $api.dom(post, '.share-thumb');
	var thumbUrl = $api.attr(thumb, 'src');
    return thumbUrl;
}

</script>
